<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>邮件模板添加</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <include file="Index/common_css"/>
    <link href="__PUBLIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
</head>

<body>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <form action="" method="post" class="form form-horizontal" id="form-admin-role-add" onsubmit="return false">

            <div class="form-group">
                <label class="col-sm-3 control-label">邮件标题：</label>
                <div class="col-sm-8">
                    <input id="title" name="title"  class="form-control" type="text"  datatype="*4-16" placeholder="邮件发送的标题">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">邮件发送编号：</label>
                <div class="col-sm-8">
                    <input id="type" name="type"  class="form-control" type="text" maxlength="6"  datatype="*4-16" placeholder="6位数的数字">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">邮件内容：</label>
                <div class="col-sm-8">
                    <!--<input id="ratio_foreign" name="ratio_foreign"  class="form-control" type="number">-->
                    <textarea id="editor"  name="content" type="text/plain" style="height:550px;"></textarea>
                </div>
            </div>


            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <button type="button" class="btn btn-success radius"  onclick="emailModel_add()" id="admin-role-save" name="admin-role-save">
                        <i class="icon-ok"></i> 确定
                    </button>

                    <a style="margin-left: 20px;" href="emailModel.html" class="btn btn-success btn-warning">
                        <i class="icon-ok"></i> 返回
                    </a>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- 全局js -->
<include file="Index/common_js"/>
<!-- Peity -->

<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/js/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/js/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/admin/js/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<!-- iCheck -->
<script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
<!-- Peity -->
<script type="text/javascript">
    UE.getEditor('editor');

</script>
<script>
//我们是共产主义的接班人
    function emailModel_add() {
        var title= $("#title").val();
        var type = $("#type").val();
        var content = UE.getEditor('editor').getContent();
        if(title=='' || type==''|| content=='') {
            layer.msg('不能为空');
        } else {
            var indx = layer.msg('提交中....', {icon: 16,shade: 0.01});
            $.post('__MODULE__/System/emailModel_add',{title:title,type:type,content:content},function (data) {
                layer.close(indx);
                if(data.status==1){
                    layer.msg(data.msg);setTimeout(function () {location.reload();}, 1000);
                }else if(data.status==0){
                    layer.msg(data.error);
                }else{
                    layer.msg('网络错误');
                }
            })
        }
    }
</script>
</body>
</html>
